


function createRadio()
{
	var fm=[];
	fm.push({fmid:'doubanfm',url:'douban.fm'});
	fm.push({fmid:'baidufm',url:'fm.baidu.com'});
	fm.push({fmid:'kaolafm',url:'www.kaolafm.com'});
	fm.push({fmid:'lizhifm',url:'www.lizhi.fm/box#play'});
	fm.push({fmid:'qingtingfm',url:'qingting.fm/channels/1007'});
	fm.push({fmid:'wangyifm',url:'music.163.com'});
	function _getfm(fmid)
	{
		for (var i=0;i<fm.length;i++ )
		{
			if(fm[i].fmid==fmid)
			{
				return fm[i].url;
			}
		}
		return false;
	}





	//fm.push({fmid:'',url:''});
	this.init=function(fmid)
	{
		_createbox(fmid);
		_bind();
	}

	var _createbox=function(fmid)
	{
		

		var fmid=fmid;
	
		if(fmid==undefined||fmid==null)
		{
			fmid="doubanfm";
		}
	
	
		$('body').append(		
		'<div class="fmboard" id="fmboard" unselectable="on" onselectstart="return false;">'+
		'<div class="fmpage">'+
		'<iframe id="fmurl" src="http://'+_getfm(fmid)+'"></iframe></div>'+
		'<div class="fmleft">'+
		'<div class="fmmorebtn">'+
		'<div class="fmclose"></div>'+
		'<div class="fmbig"></div>'+
		'<div class="fmtiny"></div>'+
		'</div>'+
		'<div class="fmselect">'+
		'<div class="fmselectbg"></div>'+
		'<div class="fmselectcnt">'+

		'<div class="fmchangel normal" id="doubanfm">'+
		'<div class="fmico">'+
		'<img class="fmicoimg" src="img/ext/fm/doubanfm.png"/></div>'+
		'<div class="fmname">豆瓣fm</div></div>'+
		'<div class="fmchangel normal" id="baidufm">'+
		'<div class="fmico">'+
		'<img class="fmicoimg" src="img/ext/fm/baidufm.png"/></div>'+
		'<div class="fmname">百度随心听</div></div>'+
		'<div class="fmchangel normal" id="kaolafm">'+
		'<div class="fmico">'+
		'<img class="fmicoimg" src="img/ext/fm/kaolafm.png"/></div>'+
		'<div class="fmname">考拉fm</div></div>'+
		'<div class="fmchangel normal" id="lizhifm">'+
		'<div class="fmico">'+
		'<img class="fmicoimg" src="img/ext/fm/lizhifm.png"/></div>'+
		'<div class="fmname">荔枝fm</div></div>'+
		'<div class="fmchangel normal" id="qingtingfm">'+
		'<div class="fmico">'+
		'<img class="fmicoimg" src="img/ext/fm/qingtingfm.png"/></div>'+
		'<div class="fmname">蜻蜓fm</div></div>'+
		'<div class="fmchangel normal" id="wangyifm">'+
		'<div class="fmico">'+
		'<img class="fmicoimg" src="img/ext/fm/wangyifm.png"/></div>'+
		'<div class="fmname">网易云</div></div>'+

		'</div>'+
		'<div class="fmtoolsboard downer">'+
		'<div class="fmtoolbtn"></div>'+
		'<div class="fmtoolcnt">'+

		'<div class="fmtool" id="" title=""></div>'+
		'<div class="fmtool" id="" title=""></div>'+
		'<div class="fmtool" id="" title=""></div>'+
		'<div class="fmtool" id="" title=""></div>'+
		
		'</div></div></div></div>'
		
		);
		
		$("#"+fmid).attr("class","fmchangel playing");
		$(".fmboard").show();
	}





	var _bind=function()
	{
		var hovertime=null;
		//var flag=false;

		//window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty(); 
		drag($(".fmboard"));

		$(".fmleft").mouseover(function(e)
		{
			var name=$(e.target).attr("class");
			if(name.indexOf('fmtiny')>=0||name.indexOf('fmbig')>=0||name.indexOf('fmclose')>=0||name.indexOf('fmmorebtn')>=0)
			{
				if($(this).find(".fmselect").css('display')=='none')
				{
					$(this).find(".fmselect").slideDown('normal');
				}
			}
			//阻止事件触发多次
			e.stopImmediatePropagation();
			
		}).mouseout(function(e)
		{
			$(this).find(".fmselect").slideUp('fast');
			//阻止事件触发多次
			e.stopImmediatePropagation();
		});


		$('.fmclose').click(function()
		{
			$(this).parents(".fmboard").fadeOut('normal',function()
			{
				$(this).remove();
			});
			$("#radiojs").remove();
		});

		$(".fmchangel").click(function()
		{
			if($(this).attr("class").indexOf("playing")>=0)
			{
				return false;
			}
			$(this).siblings(".fmchangel").attr("class","fmchangel normal");
			$("#fmurl").attr("src","http://"+_getfm($(this).attr("id")));
			$(this).attr("class","fmchangel playing");
		});
	}
}